﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="article.aspx.cs" Inherits="weikeweixin.web.admin.wechat.article" ValidateRequest="false"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>IdeaSoft软件</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="Keywords" content="IdeaSoft软件" />
    <meta name="Description" content="IdeaSoft软件微信" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.responsive.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/style.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/themes.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/todc_bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/inside.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/resource.css" />

    <link rel="stylesheet" type="text/css" href="/Scripts/KindEditor/themes/default/default.css" />
    
    <script type="text/javascript" src="/Scripts/JQuery.min.js"></script>
    <script type="text/javascript" src="/Scripts/Bootstrap.min.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.min.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.validate.min.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.validate.methods.js"></script>
    <script type="text/javascript" src="/Scripts/resource.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.cookie.js"></script>
    <script type="text/javascript" src="/Scripts/Inside.js"></script>
    <script type="text/javascript" src="/Scripts/UploadImg.js"></script>
    <script type="text/javascript" src="/Scripts/KindEditor/kindeditor-min.js"></script>
    <script type="text/javascript" src="/Scripts/KindEditor/lang/zh_CN.js"></script>
    <script type="text/javascript" src="/Scripts/KindEditor/kindeditor.config.upfile.js"></script>
    
    <!--[if IE 7]>
            <link href="/css/Bootstrap/font_awesome_ie7.css" rel="stylesheet" />
        <![endif]-->
    <!--[if lte IE 8]>
            <script src="/Scripts/excanvas_min.js"></script>
        <![endif]-->
    <!--[if lte IE 9]>
            <script src="/Scripts/watermark.js"></script>
        <![endif]-->
    <style type="text/css">
        option
        {
            padding: 5px;
        }
  </style>
</head>
<body>
    <div id="main">
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    <div class="box">
                        <div class="box-title">
                            <div class="span10">
                                <h3>
                                    <i class="icon-edit"></i>
                                    图文编辑</h3>
                            </div>
                            <div class="span2">
                                <a class="btn" href="Javascript:window.history.go(-1)">返回</a></div>
                        </div>
                        <form  action="article.aspx" method="post" class="form-horizontal form-validate">
                        <input name="action" value="save" style="display: none;" />
                        <%if (Request.QueryString["id"] != null)
                          { %>
                        <input name="id" value="<%=Request.QueryString["id"]%>" style="display: none;" />
                        <%} %>
                        <%if (Request.QueryString["article_id"] != null)
                          { %>
                        <input name="article_id" value="<%=Request.QueryString["article_id"]%>" style="display: none;" />
                        <%} %>
                        <div class="box-content">
                            <div class="control-group">
                                <label for="name" class="control-label">
                                    图文标题：</label>
                                <div class="controls">
                                    <input id="name" name="article_title" value="<%=articlemodel.article_title %>" class="input-medium" data-rule-required="true"
                                        data-rule-maxlength="50" type="text">
                                    <span class="maroon">*</span><span class="help-inline"></span>
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="description" class="control-label">
                                    图文描述：</label>
                                <div class="controls">
                                <textarea id="description" name="article_description" class="input-xlarge ui-wizard-content ui-helper-reset ui-state-default"
                                style="resize: none; width: 274px; height: 120px;" data-rule-required="true" data-rule-maxlength="255"><%=articlemodel.article_description %></textarea>
                                    <span class="maroon">*</span><span class="help-inline">描述内容不得超过225字</span>
                                </div>
                            </div>
                                                        
                            <div class="control-group">
                                <label for="sort" class="control-label">
                                    显示顺序：</label>
                                <div class="controls">
                                    <input id="sort" name="article_sort" value="<%=articlemodel.article_sort %>" class="input-mini" data-rule-required="true"
                                        data-rule-number="true" type="text">
                                </div>
                            </div>
                            
                            <div class="control-group">
                                <label for="insertimage" class="control-label">
                                    图文封面:</label>
                                <div class="controls">
                                    <img id="img_bg" alt="" type="img" src="<%=articlemodel.article_picurl %>" style="max-height: 50px;" />

                                    <input id="picurl" name="article_picurl" value="<%=articlemodel.article_picurl %>" style="height:25px;"  class="input-xlarge" readonly="readonly" data-rule-required="true"  />
                                    <a id="select" class="btn insertimage">选择封面</a>
                                </div>
                            </div>
 
                            
                            <div id="res_block">
                                <div class="control-group">
                                    <script type="text/javascript">
                                        $(function () {
                                            var type = '<%=articlemodel.article_type %>';

                                            $("#type").val(type);

                                            switch (type) {
                                                case "href":
                                                    $("#r_href").removeClass("hide");
                                                    break;
                                                case "content":
                                                    $("#r_content").removeClass("hide");
                                                    break;
                                                default:
                                                    $("#r_content").removeClass("hide");
                                                    break;
                                            }
                                        })
                                    </script>
                                    <label for="type" class="control-label">
                                        类型：</label>
                                    <div class="controls">
                                        <select id="type" name="article_type" class="input-medium">
                                            <option value="content">内容</option>
                                            <option value="href">链接</option>
                                        </select>
                                    </div>
                                </div>
                                <div id="r_content" class="control-group r-module hide">
                                    <div class="control-group">
                                        <label for="content" class="control-label">
                                            内容：</label>
                                        <div class="controls">
                                            <textarea  name="article_content" style="height: 400px; width: 640px;"><%=articlemodel.article_content%></textarea>
                                            <span class="maroon">*</span><span class="help-inline"></span>
                                        </div>
                                    </div>
                                </div>
                                <div id="r_href" class="control-group r-module hide">
                                    <div class="control-group">
                                        <label for="content" class="control-label">
                                            链接：</label>
                                        <div class="controls">
                                            <input id="href" name="article_url"  class="input-xlarge" data-rule-required="true" type="url"
                                                value="<%=articlemodel.article_url %>" />
                                            <span class="maroon">*</span><span class="help-inline"></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-actions">
                                    <button type="submit" class="btn btn-primary">
                                        保存</button>
                                    <button type="button" class="btn" onclick="window.history.go(-1);">
                                        取消</button>
                                </div>
                            </div>
                        </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="fallr-overlay">
    </div>
</body>
</html>
<script type="text/javascript">
    window.document.onkeydown = function (e) {
        if ('' == document.activeElement.id) {
            var e = e || event;
            var currKey = e.keyCode || e.which || e.charCode;
            if (8 == currKey) {
                return false;
            }
        }
    };

    KindEditor.ready(function (K) {
        Article_Editor = K.create('textarea[name="article_content"]', {
            minWidth: 400,
            resizeType: 0,
            themeType: 'simple',
            allowFileManager: true,
            allowImageUpload: true,
            uploadJson: '/Controllers/Ashx/UploadFile.ashx?p=article',
            fileManagerJson: '/Controllers/Ashx/FileManager.ashx?p=article',
            items: [
						'source', '|', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link', 'unlink', 'fullscreen', 'preview']
        });
    });

    $(function () {
        var resource = Resource.create();
        var ins = Resource.instance['res_block'];
        ins.result = ins.result || {};
        ins.result.wuid = 27743;

        window.ICON();

        $("#icon_i").removeAttr("class");
        $("a.insertimage").initUpload({ showID: 'img_bg', hideID: 'picurl', savePath: 'News&dir=image' });
    })
    $("#select").click(function () {
        $("picurl").removeClass("hide");
    })
</script>
